void a(vector<TH1 *> &v, TObject *h){ v.push_back((TH1 *)h); }
void widc(){
  TFile *f = new TFile(getenv("TMP1"), "UPDATE");
  TTree *etf = (TTree *)f->Get("etf");
  vector<TH1 *> v;

  // --------------------- 2. tracking chi Distribution ------------------------ //
  const char xuv[3] = {'X', 'U', 'V'};
  char hname[64]{}, cmd[512]{}, layer[256]{}, cut[512]{};
  int id = 0;
  for(int i = 0; i < 3; i++){
    for(int j = 0; j < 3; j++){
      for(int k = 0; k < 2; k++){
        sprintf(hname, "h%d", ++id);
        sprintf(layer, "dc%d%c%d", i, xuv[j], k);
        // sprintf(cut, "%s.fired()>=2", layer);
        // etf->Draw("dc0X0.GetWireId()>>h1(83, -1.5, 81.5)", "", "");
        sprintf(cmd, "%s.GetWireId()>>%s(83, -1.5, 81.5)", layer, hname);
        etf->Draw(cmd, cut); a(v,f->Get(hname));
        TH1 *h = v[v.size()-1];
        h->GetXaxis()->SetTitle("Wire Id");
      } // end for over x1-2
    } // end for over x,u,v
  } // end for over dcs

  TCanvas *c1 = new TCanvas("c", "Wire Distribution for post Mag dcs", 1680, 1050);
  c1->Divide(6,3);
  for(int i = 0; i < 18; i++){
    c1->cd(i+1); v[i]->Draw();
  } // end for
  c1->Print("widc.pdf");
} // end vis
